if __name__=="__main__":
    nums=int(input().strip())
    for i in range(nums):
        data=list(map(int,input().strip().split()))
        n,array=data[0],data[1:]
        sum=0
        for i in range(n):
            sum+=array[i]
        print(sum)


